Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slf4j bridge - init lock #789

Merged
merged 4 commits into from
Nov 22, 2023
Merged

slf4j bridge - init lock #789

merged 4 commits into from
Nov 22, 2023

Conversation

justcoon
Copy link
Contributor

add init log for slf4j bridge
more like in case of zio app, where there is just one initialisation it is not issue

but in case of tests, and multiple parallel initialisations, it is making issues like:

- Slf4jBridge - parallel init
  Exception in thread "zio-fiber-91,78" java.lang.ClassCastException: class org.slf4j.helpers.SubstituteLoggerFactory cannot be cast to class zio.logging.slf4j.bridge.LoggerFactory (org.slf4j.helpers.SubstituteLoggerFactory and zio.logging.slf4j.bridge.LoggerFactory are in unnamed module of loader sbt.internal.LayeredClassLoader @3c6460fa)
  at zio.logging.slf4j.bridge.Slf4jBridge$.$anonfun$layer$3(Slf4jBridge.scala:43)
  at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
  at zio.logging.slf4j.bridge.Slf4jBridge.layer(Slf4jBridge.scala:39)
  at zio.logging.slf4j.bridge.Slf4jBridge.layer(Slf4jBridge.scala:37)
  at zio.logging.slf4j.bridge.Slf4jBridgeSpec.spec(Slf4jBridgeSpec.scala:27)
  at zio.logging.slf4j.bridge.Slf4jBridgeSpec.spec(Slf4jBridgeSpec.scala:24)
  Exception in thread "zio-fiber-90,79" java.lang.ClassCastException: class org.slf4j.helpers.SubstituteLoggerFactory cannot be cast to class zio.logging.slf4j.bridge.LoggerFactory (org.slf4j.helpers.SubstituteLoggerFactory and zio.logging.slf4j.bridge.LoggerFactory are in unnamed module of loader sbt.internal.LayeredClassLoader @3c6460fa)
  at zio.logging.slf4j.bridge.Slf4jBridge$.$anonfun$layer$3(Slf4jBridge.scala:43)
  at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
  at zio.logging.slf4j.bridge.Slf4jBridge.layer(Slf4jBridge.scala:39)
  at zio.logging.slf4j.bridge.Slf4jBridge.layer(Slf4jBridge.scala:37)
  at zio.logging.slf4j.bridge.Slf4jBridgeSpec.spec(Slf4jBridgeSpec.scala:27)
  at zio.logging.slf4j.bridge.Slf4jBridgeSpec.spec(Slf4jBridgeSpec.scala:24)
  Exception in thread "zio-fiber-87,80" java.lang.ClassCastException: class org.slf4j.helpers.SubstituteLoggerFactory cannot be cast to class zio.logging.slf4j.bridge.LoggerFactory (org.slf4j.helpers.SubstituteLoggerFactory and 

@justcoon justcoon requested a review from a team as a code owner November 19, 2023 17:58
org.slf4j.LoggerFactory
.getILoggerFactory()
.asInstanceOf[LoggerFactory]
.attacheRuntime(new ZioLoggerRuntime(runtime))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, sure but i think it will be better to fix it in next major release

adamgfraser
adamgfraser previously approved these changes Nov 22, 2023
@justcoon justcoon merged commit 378e144 into zio:master Nov 22, 2023
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants